-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add conversion from AbstractArray to mxarray #229
Add conversion from AbstractArray to mxarray #229
Conversation
I removed the definitions for Ranges and BitArrays since they are only be a special case of AbstractArray, would unnecessary allocate data and get copied to MATLAB anyway Old defs: mxarray(a::BitArray) = mxarray(convert(Array{Bool}, a))
mxarray(a::AbstractRange) = mxarray([a;]) New definition was tested with additional special matrix types such as function mxarray(a::AbstractArray{T}) where {T<:MxRealNum}
mx = mxarray(T, size(a))
ptr = data_ptr(mx)
na = length(a)
dat = unsafe_wrap(Array{T}, ptr, na)
for (i, ix) in enumerate(eachindex(a))
dat[i] = a[ix]
end
return mx
end
|
@tqml Would it be helpful to give you commit access to be able to merge your PRs and perform maintenance on the package? |
Hey @ViralBShah |
I don't know of other active maintainers. It is always welcome for someone to do the minimum to maintain a package, and make releases etc. It is not necessarily a commitment to take on major development work. If you're ok to get this one merged and release, that would already be quite welcome. |
Yeah my apologies. I'm the last active maintainer of this package. Haven't been keeping up to speed with all the pull requests. |
In any case this looks good to me |
@@ -276,8 +277,30 @@ function mxarray(a::Array{T}) where T<:MxComplexNum | |||
mx | |||
end | |||
|
|||
mxarray(a::BitArray) = mxarray(convert(Array{Bool}, a)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the function below still work?
Thanks @musm. |
Thanks @ViralBShah for the invite and thanks @musm for merging this PR :) |
Is it worth tagging a new release? Seems like a few things have accumulated since the last release. |
Good idea, the last release also was also some time ago. Can we justify v0.9? I'm also not familiar with the Julia release process. Do you just create a new Git Tag and some automation does the rest? |
If its fine for you, I would include #231 in the release as well, it adds some new conversations for tuples |
Yes, please do include. The process of releasing is fairly straightforward. The way I do it is:
|
@ViralBShah @musm are you familiar why the package needs a Were there issues to get the file path at "runtime" (or when imported)? |
This definitely sounds like how things were done a few years ago. Much of this went away with BinaryBuilder and artifacts but a lot of that won’t help here. Still I wouldn’t be surprised if folks can do better. |
Adds a conversion method to convert Julia abstract array to mxarray to avoid having them treated as structs in MATLAB.
Example:
Related issue #196